<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>
        收款合同
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../../css/main.css" media="all">
    <script type="text/javascript" src="../../../lib/loading/okLoading.js"></script>
    <link rel="stylesheet" href="../../../css/bootstrap.css">
    <link rel="stylesheet" href="../../../lib/layui/css/layui_2.5.7.css">
    <style>
        .layui-table-page select {
            height: 22px;
        }
    </style>
</head>

<body>
<div class="x-nav">
        <span class="layui-breadcrumb">
            <a><cite>首页</cite></a>
            <a><cite>财务业务</cite></a>
            <a><cite>合同信息</cite></a>
        </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon"
                                                                        style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="row">
        <div class="col-xs-6 col-sm-4 col-md-3">
            <section class="panel">
                <div class="symbol bgcolor-blue"><i class=" iconfont icon-dashaxiaoqudizhi01"></i>
                </div>
                <div class="value tab-menu" bind="1">
                    <a href="javascript:;" data-url="user-info.html" data-parent="true" data-title="收款总额（元）"><i
                            class="iconfont " data-icon=""></i>
                        <h1>45</h1>
                    </a>
                    <a href="javascript:;" data-url="user-info.html" data-parent="true" data-title="收款总额（元）"> <i
                            class="iconfont " data-icon=""></i><span>收款总额（元）</span></a>
                </div>
            </section>
        </div>

        <div class="col-xs-6 col-sm-4 col-md-3">
            <section class="panel">
                <div class="symbol bgcolor-commred"><i class="iconfont icon-dashaxiaoqudizhi01"></i>
                </div>
                <div class="value tab-menu" bind="1">
                    <a href="javascript:;" data-url="user-info.html" data-parent="true" data-title="收款合同（个）"> <i
                            class="iconfont " data-icon=""></i>
                        <h1>8310</h1>
                    </a>
                    <a href="javascript:;" data-url="user-info.html" data-parent="true" data-title="收款合同（个）"> <i
                            class="iconfont " data-icon=""></i><span>收款合同（个）</span></a>
                </div>
            </section>
        </div>


        <div class="col-xs-6 col-sm-4 col-md-3">
            <section class="panel">
                <div class="symbol bgcolor-yellow-green"><i class="iconfont icon-dashaxiaoqudizhi01"></i>
                </div>
                <div class="value tab-menu" bind="1">
                    <a href="javascript:;" data-url="user-info.html" data-parent="true" data-title="付款总额（元）"> <i
                            class="iconfont " data-icon=""></i>
                        <h1>1314</h1>
                    </a>
                    <a href="javascript:;" data-url="user-info.html" data-parent="true" data-title="付款总额（元）"> <i
                            class="iconfont " data-icon=""></i><span>付款总额（元）</span></a>
                </div>
            </section>
        </div>
        <div class="col-xs-6 col-sm-4 col-md-3">
            <section class="panel">
                <div class="symbol bgcolor-dark-green"><i class="iconfont icon-dashaxiaoqudizhi01"></i>
                </div>
                <div class="value tab-menu" bind="1">
                    <a href="javascript:;" data-url="user-info.html" data-parent="true" data-title="付款合同（个）"> <i
                            class="iconfont " data-icon=""></i>
                        <h1>1314</h1>
                    </a>
                    <a href="javascript:;" data-url="user-info.html" data-parent="true" data-title="付款合同（个）"> <i
                            class="iconfont " data-icon=""></i><span>付款合同（个）</span></a>
                </div>
            </section>
        </div>

    </div>

    <div class="main_box">
        <div class="panel-heading">
            <ul class="nav nav-tabs" id="navTabs">
                <li class="active"><a class="receivePane" data-tab="" href="collectioncontract.html">收款合同</a></li>
                <li class=""><a class="payPane" data-tab="" href="#">付款合同</a></li>
            </ul>
        </div>
    </div>

    <form class="layui-form x-center">
        <div class="layui-form-pane" style="margin-top: 15px;">
            <div class="layui-form-item">
                <label class="layui-form-label">客户名称</label>
                <div class="layui-input-inline">
                    <input  autocomplete="off"  type="text" class="layui-input" name="remark" placeholder="客户名称">
                </div>
                <label class="layui-form-label">项目名称</label>
                <div class="layui-input-inline">
                    <input  autocomplete="off"  type="text" class="layui-input" name="typeOfPayment" placeholder="项目名称">
                </div>
                <label class="layui-form-label">合同类型</label>
                <div class="layui-input-inline">
                    <input  autocomplete="off"  type="text" class="layui-input" name="repaymentUnit" placeholder="合同类型">
                </div>
                <div class="layui-input-inline layui-show-xs-block">
                    <button class="layui-btn" type="button" lay-filter="sreach" data-type="reload"
                            onclick="reload()">
                        <i class="layui-icon">&#xe615;</i></button>
                </div>

            </div>
        </div>
    </form>


    <xblock>

        <button class="layui-btn" onclick="admin_add('添加','collectioncontract_add.html','1000','600')"><i
                class="layui-icon">&#xe608;</i>添加
        </button>
    </xblock>
    <div class="layui-card-body">
        <h5 class="red_color">收款总额：65147010 元，已收金额：31081499.5 元，未收金额：33916510.5 元，已开票金额：22551972.5 元 ，终结金额：149000 元
            。</h5>
        <table class="layui-table" id="test" lay-filter="test">
        </table>
    </div>


</div>
<script type="text/html" id="barDemo">
    <a title="编辑" lay-event="view" class="ml-5 layui-btn-xs layui-btn" style="text-decoration:none">编辑</a>
    <a title="终结" lay-event="over" class="ml-5 layui-btn-xs layui-btn layui-btn-warm"
       style="text-decoration:none">终结</a>
    <a title="删除" href="javascript:;" class="layui-btn-xs layui-btn layui-btn-danger" lay-event="del"
       style="text-decoration:none">
        删除
    </a>
    </a>
</script>

<script type="text/javascript" src="../../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../../js/myAjax.js"></script>
<script type="text/javascript" src="../../../js/pub.js"></script>
<script type="text/javascript" src="../../../lib/layui/layui2.5.7.js"></script>
<!-- <script src="lib/layui/layui.js" charset="utf-8"></script> -->
<script src="../../../js/x-layui.js" charset="utf-8"></script>
<script>
    layui.use(['laydate', 'element', 'laypage', 'layer', 'form'], function () {
        $ = layui.jquery;//jquery
        laydate = layui.laydate;//日期插件
        lement = layui.element;//面包导航
        laypage = layui.laypage;//分页
        layer = layui.layer;//弹出层
        var form = layui.form;
        okLoading.close($);
    });
</script>


<script>

    layui.use(['laydate', 'form'],
        function () {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                trigger: 'click',
                type: 'datetime',
                elem: '#start' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
                trigger: 'click',
                type: 'datetime',
                elem: '#end' //指定元素
            });
        });
    layui.use('table', function () {
        table = layui.table;
        //方法级渲染
        var t1 = table.render({
            elem: '#test',
            url: $baseUrl + 'borrowAndReturnWater/findBorrowAndReturnWaterList',
            where: {
                userId: $userId,
                type: '借款'
            },
            headers: {
                token: $token
            }
            , toolbar: '#toolbarDemo',

            // toolbar: true,
            cols: [
                [
                    {
                        field: 'id',
                        title: '序号',
                    },
                    {
                        field: 'type',
                        title: '性质',
                    },
                    {
                        field: 'repaymentAmount',
                        title: '合同类型',
                    },
                    {
                        field: 'revenueAndExpenditureChannels',
                        title: ' 关联客户及项目',
                    },
                    {
                        field: 'repaymentDate',
                        title: '合同总额/元',
                    },
                    {
                        field: 'repaymentUnit',
                        title: '已发生额/元',
                    },
                    {
                        field: 'typeOfPayment',
                        title: '未发生额/元',
                    },


                    {
                        field: 'repaymentUnit',
                        title: '发票金额/元',
                    },

                    {
                        field: 'dateOfLoan',
                        title: '签订日期',
                    },
                    {
                        field: 'remark',
                        title: '电梯总量/台',
                    },
                    {
                        field: 'addUserId',
                        title: '品牌&台量',
                    },
                    {
                        field: 'addUserId',
                        title: '强制终结',
                    },
                    {
                        field: 'addUserId',
                        title: '增加时间',
                    },


                    {
                        field: 'status',
                        title: '操作',
                        templet: '#barDemo',
                        width: '9%'

                    }]
            ],
            request: {
                pageName: 'pageNum', //页码的参数名称，默认：page
                limitName: 'pageSize',
            },
            response: {
                statusName: 'code' //规定数据状态的字段名称，默认：code
                ,
                statusCode: 0 //规定成功的状态码，默认：0
                ,
                msgName: 'msg' //规定状态信息的字段名称，默认：msg
                ,
                countName: 'total' //规定数据总数的字段名称，默认：count
                ,
                dataName: 'data', //规定数据列表的字段名称，默认：data
            },
            id: 'test',
            page: true,
            height: 'auto',
            even: true,
            done: function (res, curr, count) {
                //是否有权限或权限是否失效
                // authorizeState();
            }
        });


        //修改状态
        let form = layui.form;
        form.on('switch(setStatus)', function (obj) {
            let arr = obj.value.split("|");
            let request = {
                url: "admin/editUserStatus",
                method: "POST",
                data: {
                    status: arr[0] === '0' ? 1 : 0,
                    id: arr[1],
                    userId: $userId
                }
            };
            sendRequest(request, (data) => {
                if (data.code === 0) {
                    layer.msg("修改成功", {
                        icon: 1
                    });

                } else {
                    layer.msg(data.msg, {
                        icon: 5
                    });
                }
            })
        });

        //监听工具条
        table.on('tool(test)', function (obj) { //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
            let data = obj.data; //获得当前行数据
            let layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            if (layEvent === 'del') { //删除
                layer.confirm('是否确认删除 【' + data.id + '】 ？', {
                    icon: 3,
                    title: '提示'
                }, function (index) {
                    let request = {
                        url: "/borrowAndReturnWater/delBorrowAndReturnWater/" + data.id,
                        data: {
                            userId: $userId,
                        },
                        method: "delete",
                    };
                    sendRequest(request, (data) => {
                        if (data.code === 0) {
                            layer.msg("删除成功", {
                                icon: 1
                            });
                            t1.reload();
                        } else {
                            layer.msg("删除失败，请稍后再试！", {
                                icon: 5
                            });
                        }
                    });
                    layer.close(index);
                });
            } else if (layEvent === 'view') { //编辑
                x_admin_show('编辑用户', 'LoanFlowedit.html?recordId=' + data.id, "1200", "600")
            }
        });

    });

    function reload(value) {
        table.reload('test', {
            where: {
                remark: $("input[name=remark]").val(),
                typeOfPayment: $("input[name=typeOfPayment]").val(),
                repaymentUnit: $("input[name=repaymentUnit]").val(),

            }
        });
    }

    function admin_add(title, url, w, h) {
        x_admin_show(title, url, w, h);
    }
</script>
</body>

</html>
